<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  
  <style type="text/css">
  	p{
  	text-align: center;
  	color: red;
  	}
  </style>
  </head>
  
  <body>
		<h1 style="text-align: center;">我的京东_添加商品</h1> <hr/>
		
		<form action="${pageContext.request.contextPath }/seller/addProd" method="post"
			  enctype="multipart/form-data">
			<table border="1" cellspacing="0" cellpadding="10" align="center">
					<tr>
						<td>商品名称:</td>
						<td> <input type="text" name="name" value="" size="40" maxlength="20"/> </td>
					</tr>
					<tr>
						<td>单价:</td>
						<td> <input type="number" name="price" value="" min="0" step="0.01"/> </td>
					</tr>
					
					<tr>
						<td>商品种类:</td>
						<td> <select name="typeid" id="s1">
							<option value="">请选择</option>
							<%--<option value="电子数码">电子数码</option>
							<option value="日用百货">日用百货</option>
							<option value="床上用品">床上用品</option>
							<option value="家用电器">家用电器</option>
							<option value="图书杂志">图书杂志</option>--%>
						</select> 
						</td>
					</tr>
					
					<tr>
						<td>库存数量:</td>
						<td> <input type="number" name="pnum" value="" min="0" step="1"/> </td>
					</tr>
					
					<tr>
						<td>商品图片:</td>
						<td> <input type="file" name="aa" /> </td>
					</tr>
					
					
					<tr>
						<td>描述信息:</td>
						<td> <textarea name="description" rows="10" cols="30"></textarea> </td>
					</tr>
					<tr>
						<td colspan="2" align="center">  
							<input type="submit" value="添加商品" />
							<input type="reset" value="重置"/>
						</td>
					</tr>
			</table>
		</form>
  </body>

<script src="../js/jquery-1.12.4.js"></script>

<script>

	$.post("${pageContext.request.contextPath}/types",function(result){
			if(result.code == 200){
				for(var i = 0;i<result.obj.length;i++){
					var  type = result.obj[i];
					$("#s1").append('<option value="'+type.id+'">'+type.name+'</option>');
				}
			}
	},"json")

</script>
</html>
